//
//  HotSearchFrameModel.m
//  ChunLaiZhuangClient
//
//  Created by zzs on 16/3/11.
//  Copyright © 2016年 CLZ. All rights reserved.
//

#import "HotSearchFrameModel.h"

@implementation HotSearchDataModel

@end



@implementation HotSearchFrameModel
-(void)setDataModel:(HotSearchDataModel *)dataModel{
    _dataModel=dataModel;
    CGFloat total_x = 14.0f, total_y = 6.0f, labelH = 28.0f;
    NSInteger line = 1;
    for (int i=0; i<dataModel.hotArray.count; ++i) {
        NSString *msgString = dataModel.hotArray[i];
        
        CGFloat padding_x = 14.0f, padding_y = 15.0f;
        
        // iOS7depre
        CGSize size = [msgString sizeWithFont:[UIFont systemFontOfSize:12.0f]
                            constrainedToSize:CGSizeMake(250.0f, 22.0f) lineBreakMode:NSLineBreakByWordWrapping];
        size.width += 10;
        CGFloat next_x = total_x + (size.width+padding_x);
        
        if (next_x > SCREEN_WIDTH) {// 另起一行
            line += 1;
            
            total_y = total_y + (labelH+padding_y);
            total_x = 14.0f;
        }
        else{
            total_x = total_x + (size.width+padding_x);
        }
    }
    
    self.cellHeight=total_y+labelH;

}
@end
